{  Statement: http://acmp.ru/?main=task&id_task=115
   Verdict: Accepted
}
uses
    SysUtils, Math;

var
    i, j, n, m, k, ans, ii, jj : longint;
    a : array[0..110, 0..110] of longint;    
    
begin
    reset(input,'input.txt');
    rewrite(output,'output.txt');
    read(n, m);
    fillchar(a, sizeof(a), 0);
    ans := -maxlongint;
    for i := 1 to n do
        for j := 1 to m do begin
            read(k);
            a[i][j] := a[i - 1][j] + a[i][j - 1] - a[i - 1][j - 1] + k;
        end;
    for i := 1 to n do
        for j := 1 to m do
            for ii := i to n do
                for jj := j to m do
                    ans := max(ans, a[ii][jj] + a[i - 1][j - 1] - a[i - 1][jj] - a[ii][j - 1]);
    write(ans);
end.